home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 1 / ETO Development Tools 1.iso / Essentials / MacApp Documentation / MacApp AppleLink Messages / MacApp.Tech$ 4⁄13⁄90 / 1087-None-Apr90 < prev    next >
Encoding:
Text File  |  1990-04-16  |  2.3 KB  |  85 lines  |  [TEXT/GEOL]

  1. Item forwarded  by  A33          to A34
  2.  
  3. Item    3281057                         12-April-90        13:04PDT
  4.  
  5. From:   POWERUP.ENG                     Power Up Software,PRT
  6.  
  7. To:     MACAPP.TECH$                    MacApp Technical
  8.  
  9. Sub:    None
  10.  
  11. Attn:   MacApp.Tech$
  12. SentBy: James Plamondon
  13. Date   4/6/90
  14. Subject    None
  15. From   James Plamondon
  16. To   MacApp.Tech$
  17.  
  18. Subject:
  19. Gentlepersons,
  20.  
  21. I have a question of style that is causing some dissention here — and I was
  22. hoping to put the issue to an informal vote.
  23.  
  24. Assume the existence of the MacApp 2.0 Final routine PostCommand(), which
  25. posts the given command to the command queue.  Given this function (and the
  26. command queue), one can contemplate writing a TCmdButton control, which posts
  27. a command when pressed.
  28.  
  29. Assume further that the class TCmdButton has a field, fCmdClassName, which
  30. specifies the class of command to be posted.  (We can use
  31. NewObjectByClassName() to build the command.)
  32.  
  33. The argument rages over two possible implementations of TCmdButton's command
  34. posting:  Should it be placed in an override of TrackMouse(), or in an
  35. override of DoChoice()?  Either will work; it is just a question of elegance,
  36. clarity, and the quality of being insulated from future changes to MacApp.
  37.  
  38. Here are example implementations:
  39.  
  40. {—————————————————————————————————————————}
  41.  
  42. PROCEDURE TCmdButton.TrackMouse(<its arguments>); OVERRIDE;
  43.     BEGIN
  44.     INHERITED TrackMouse(<same arguments>);
  45.  
  46.     IF (aTrackPhase = trackRelease)
  47.     THEN
  48.         BEGIN
  49.         { create, initialize, and post the command }
  50.         END;
  51.     END;  { TrackMouse }
  52.  
  53. {—————————————————————————————————————————}
  54.  
  55. …OR…
  56.  
  57. {—————————————————————————————————————————}
  58.  
  59. PROCEDURE TCmdButton.DoChoice(<its arguments>); OVERRIDE;
  60.     BEGIN
  61.     IF (origView = SELF) &
  62.         (itsChoice = mButtonHit)
  63.     THEN
  64.         BEGIN
  65.         { create, initialize, and post the command }
  66.         END;
  67.  
  68.     INHERITED DoChoice(<same arguments>);
  69.     END;  { TrackMouse }
  70.  
  71. {—————————————————————————————————————————}
  72.  
  73. Note that SELF.DoChoice() is called in TControl.TrackMouse() when aTrackPhase
  74. = trackRelease.
  75.  
  76. Without biasing your opions one way or the other by giving my preference, I
  77. ask:  which implementation do you prefer, and why?
  78.  
  79. Looking forward to your responses, I remain,
  80.  
  81. Yours,
  82.  
  83. James Plamondon
  84.  
  85.